const obj = {
  name: "hugo",
};
function testFunc(a, b, c) {
  console.log("this", this);
  console.log(a, b, c);
  return "this is fn1";
}

testFunc.call(obj, "a", "b", "c");
testFunc.apply(obj, ["a", "b", "c"]);

const core = (context, args, _this) => {
  args = args || [];
  const key = Symbol();
  context[key] = _this;
  delete context[key];
  return context;
};

Function.prototype.callFn = function (context, ...args) {
  return core(context, args, this);
};
Function.prototype.applyFn = function (context, args) {
  return core(context, args, this);
};

testFunc.callFn(obj, "a", "b", "c");
testFunc.callFn(obj, ["a", "b", "c"]);
